﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace Class_KetNoi
{
    public class KetNoi_PhongBan:KetNoiCoSoDuLieu
    {
        public void them_PhongBan(string @TenPB, string @DienThoai, string @Fax)
        {
            SqlCommand cmd = new SqlCommand("dbo.insert_PhongBan",cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter p = new SqlParameter("TenPB", TenPB);
            cmd.Parameters.Add(p);
            p = new SqlParameter("@DienThoai", DienThoai);
            cmd.Parameters.Add(p);
            p = new SqlParameter("@Fax", Fax);
            cmd.Parameters.Add(p);
            cmd.ExecuteNonQuery();
        }
        public void sua_PhongBan(string @MaPB,string @TenPB,string @DienThoai,string @Fax)
        {
            SqlCommand cmd = new SqlCommand("dbo.update_PhongBan", cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter p = new SqlParameter("@MaPB",MaPB);
            cmd.Parameters.Add(p);
            p = new SqlParameter("TenPB", TenPB);
            cmd.Parameters.Add(p);
            p = new SqlParameter("@DienThoai", DienThoai);
            cmd.Parameters.Add(p);
            p = new SqlParameter("@Fax", Fax);
            cmd.Parameters.Add(p);
            cmd.ExecuteNonQuery();
        }
        public void xoa_PhongBan(string @MaPB)
        {
            SqlCommand cmd = new SqlCommand("dbo.delete_PhongBan", cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter p = new SqlParameter("@MaPB",MaPB);
            cmd.Parameters.Add(p);
            cmd.ExecuteNonQuery();
        }
    }
}
